package org.lee.controller;

import java.util.List;

import org.lee.bean.common.CustomBean;
import org.lee.bean.domain2.Person2;
import org.lee.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("person2")
public class Person2Controller {

	@Autowired PersonService service;
	
	@RequestMapping(value="search")
	public Person2 search(int id){
		return service.find2(id);
	}
	
	@RequestMapping(value="add")
	public Person2 add(@RequestParam(value="fail", defaultValue="false", required=false) boolean fail){
		return service.save2(fail);
	}
	
	@RequestMapping(value="search/native")
	public List<CustomBean> seachNative(@RequestParam(value="id", defaultValue="1", required=false) int id){
		return service.findCustomBean2(id);
	}
}
